Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mars receipt exception #96

Merged
merged 12 commits into from
Dec 23, 2024
Merged

Mars receipt exception #96

merged 12 commits into from
Dec 23, 2024

Conversation

Pedram-A-Keyvani
Copy link
Collaborator

Showing errors in MARS receipt in the happening of:

  • MarsReceiptException that are custom errors from the API
  • Exception for catching all the other errors

CAUTION: The receipt errors might contain technical information

@Pedram-A-Keyvani
Copy link
Collaborator Author

#67 closed

@bedroesb bedroesb linked an issue Dec 4, 2024 that may be closed by this pull request
Copy link
Collaborator

@apriltuesday apriltuesday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! As we discussed, I think this will help us start handling errors in the CLI, so we can continue to iterate on this.

@bedroesb
Copy link
Member

Thanks a lot @Pedram-A-Keyvani!

@bedroesb
Copy link
Member

I just tested the code, and triggered an error by doing a submission twice using the same data:

mars-cli --development submit          --credential-service-name biosamples          --credentials-file /home/bedro/Documents/MARS/mars-cli/tests/test_credentials_example.json          --file-transfer ftp          --data-files /home/bedro/Documents/MARS/test-data/ENA_TEST2.R2.fastq.gz   --submit-to-metabolights False      --output final-isa          /home/bedro/Documents/MARS/test-data/biosamples-input-isa.json
/home/bedro/.config/python_keyring
keyring.backends.SecretService.Keyring (priority: 5)
############# Welcome to the MARS CLI. #############
Running in Development environment
Starting submission of the ISA JSON to the target repositories: biosamples, ena.
ISA JSON with investigation 'Bob's investigation' is valid.
Submission to TargetRepository.BIOSAMPLES was successful. Result:
{'targetRepository': 'biosamples', 'errors': [], 'info': [], 'accessions': [{'value': 'SAMEA131504279', 'path': [{'key': 'investigation'}, {'key': 'studies', 'where': {'key': 'title', 'value': 'Arabidopsis thaliana'}}, {'key': 'materials'}, {'key': 'samples', 'where': {'key': 'name', 'value': 'leaf 1'}}]}, {'value': 'SAMEA131504278', 'path': [{'key': 'investigation'}, {'key': 'studies', 'where': {'key': 'title', 'value': 'Arabidopsis thaliana'}}, {'key': 'materials'}, {'key': 'sources', 'where': {'key': 'name', 'value': 'plant 1'}}]}]}
#sample/331: comments=[] id='#ontology_annotation/accession_#sample/331' annotationValue='SAMEA131504279' termAccession=None termSource=None.
#source/330: comments=[] id='#ontology_annotation/accession_#source/330' annotationValue='SAMEA131504278' termAccession=None termSource=None.
ENA_TEST2.R2.fastq.gz already exists and has the same size on the FTP, skipping
Start submitting to TargetRepository.ENA.
Submission to TargetRepository.ENA was successful. Result:
{'targetRepository': 'ena', 'errors': [{'type': 'INVALID_METADATA', 'message': 'ENA receipt: Accession number of Arabidopsis thaliana-0.7403975790744531 is NULL'}, {'type': 'INVALID_METADATA', 'message': 'ENA receipt: Accession number of #other_material/332-0.7403975790744531 is NULL'}, {'type': 'INVALID_METADATA', 'message': 'ENA receipt: Accession number of #other_material/333-0.7403975790744531 is NULL'}, {'type': 'INVALID_METADATA', 'message': 'ENA receipt: Accession number of #assay/18_20_21-0.7403975790744531 is NULL'}, {'type': 'INVALID_METADATA', 'message': 'File ENA_TEST2.R2.fastq.gz has already been submitted in ERR14097866 and is waiting to be processed'}], 'info': [{'message': 'This submission is a TEST submission and will be discarded within 24 hours'}], 'accessions': []}
Update ISA-JSON based on receipt from TargetRepository.ENA.

Just as a note, the current MARS CLI still dumps a updated ISA JSON with the BioSamples accessions, which is I think a desired behavior.

@bedroesb bedroesb merged commit 08cc1ba into main Dec 23, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Repository API receipt error catching
3 participants